<template>
  <div>
    <div style="height: 50px;margin-top: -55px" class="haha1">
      <div style="float:left;margin-left:20px" @click="my()">
        <i style="margin-left:0px;margin-top:10px; color: #f9fafc;font-size: 30px" class="el-icon-arrow-left"></i>
      </div>
    </div>
    <div style="height: 60px">
      <div style="margin-top: 20px;height: 30px">
        <font size="5px">嘉禾一品(温都水城)</font>
      </div>
      <div style="height: 30px;line-height: 30px">
        <font size="2px">4.2 月fixed售90单 饿了么专送 约28分钟 距离1000m</font>
      </div>
    </div>
    <div>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="点餐" name="first">
          <el-table
            :data="listGoods"
            border
            style="width: 100%">
            <el-table-column
              fixed
              prop="g_name"
              label="商品名称"
              width="150">
            </el-table-column>
            <el-table-column
              prop="g_price"
              width="120"
              label="商品单价">
            </el-table-column>
            <el-table-column
              label="添加购物车"
            >
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="addCart(scope.row)">添加购物车</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div style="height: 50px" class="fixed">
            <div style="float: left;margin-left: 10px;width: 20%;margin-top: 8px">
              <el-row>
                <el-button type="primary"  @click="goCart()">查看购物车</el-button>
              </el-row>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="评价" name="second">
          <div >
            <div style="height: 130px;background-color:#FCE0E6">
              <div style="height: 100%;width: 30%;background-color: #FCE0E6;float: left">
                <div style="margin-top: 45px">
                  <font size="5px" color="#E2C13F">{{pj}}</font>
                  评分
                </div>
              </div>
              <div style="height: 100%;width: 70%;background-color: #FCE0E6;float: right">
                <div style="height: 43px;margin-top: 30px">
                  <el-rate
                    v-model="pj"
                    disabled
                    show-score
                    text-color="#ff9900"
                    score-template="商家评分{value}">
                  </el-rate>
                </div>
                <div style="height: 43px">
                  送达时间28分钟
                </div>
              </div>
            </div>
          </div>
          <div style="background-color: #66B1FF">
            <p v-for="(lc,i) in listCommnet">
              <el-row :gutter="20" style="height: 50px;width: 480px">
                <el-col style="width: 20%;height: 50px"><div class="grid-content bg-purple"><font size="2px">{{lc.e_time}}</font></div></el-col>
                <el-col style="width: 20%;height: 50px"><div class="grid-content bg-purple">
                  <el-rate
                    v-model="lc.e_type"
                    disabled
                    show-score
                    text-color="#ff9900"
                    score-template="{value}">
                  </el-rate>
                </div></el-col>
                <el-col style="width: 60%;height: 50px"><div class="grid-content bg-purple">{{lc.e_content}}</div></el-col>
              </el-row>
            </p>
          </div>
        </el-tab-pane>
        <el-tab-pane label="商家" name="third">
          <div>
            <div style="height: 20px;margin-left: -300px">
              <h4>配送信息</h4>
            </div>
            <div style="height: 10px">

            </div>
            <div style="height: 50px;margin-left: 30px">
              4.2 月售90单 饿了么专送 约28分钟 距离1000m  配送费8￥
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
  import axios from 'axios';
  export default {
    data() {
      return {
        pj:'',
        text: '',
        textarea: '',
        activeName: 'second',
        value: 0.0,
       /* value1: 0.0,*/
        num: 0,
        skx: 0,
        money: 0,
        gridData: [{
          date: '2016-05-02',
          name: '王小虎',
        },{
          date: '2016-05-03',
          name: '王小虎',
        }],
        dialogTableVisible: false,
        listGoods:[
          {
            g_id: "",
            g_name: "",
            g_price: "",
            g_discount: "",
            g_image: "",
            m_id: "",
            g_descripe: "",
            g_sale: "",
            g_goodevaluate: "",
          }
        ],
        listCommnet:[
          {
            e_id: "",
            e_type: "",
            e_content: "",
            e_time: "",
            e_level: "",
            m_id: "",
            u_id: "",
          }
        ]
      };
    },
    methods: {
      handleClick(tab, event) {
        console.log(tab, event);
      },
      addCart(obj){
        axios.post("/vip/CartController/addCart",obj).then(function (res) {
          if(res.data.msg=="ok"){
            alert("添加成功");
          }
        })
      },
      my(){
        this.$router.push({name:"waimai"});
      },
      selById(m_id){
        var _this = this;
        axios.get("/waimai/GoodsController/selGoodsByMerchantId/"+m_id).then(function (res) {
          _this.listGoods = res.data;
        })
      },
      selCommentById(m_id){
        var _this = this;
        axios.get("/vip/CommentController/selCommnetByMid/"+m_id).then(function (res) {
          _this.listCommnet = res.data;
        })
      },
      selAllYes(m_id){
        var _this = this;
        axios.get("/vip/CommentController/selAllYes/"+m_id).then(function (res) {
          _this.pj = res.data;
        })
      },
      goCart(){
        this.$router.push({name:"cart"});
      }
    },
    mounted() {
      var m_id = this.$route.params.m_id;
      this.selById(m_id);
      this.selCommentById(m_id);
      this.selAllYes(m_id);
    }
  };
</script>

<style scoped>
  /*将div固定底部  css*/
  .fixed{ position:fixed;
    left:0px;
    bottom:0px;
    width:100%;
    height:50px;
    background-color:darkseagreen;
    z-index:9999;
  }
  .haha1{
    background-image: url(../assets/22.png);
  }
</style>
